package com.app.teadoor.bean;

import android.text.TextUtils;

import com.app.teadoor.basis.Constants;
import com.app.teadoor.util.MyUtils;

import my.FileUtils;

public class LoginServiceListData extends BasisBean {

	public static final String FILE_CACHE = Constants.DIR_FILECACHE
			+ "login_servie__data.data";

	/**
	 *
	 */
	private static final long serialVersionUID = 1L;

	public static boolean isDataNull() {
		LoginServiceListData data = (LoginServiceListData) FileUtils.readObject(FILE_CACHE);
		if(data == null)return true;
//		if(TextUtils.isEmpty(data.getIp())  || TextUtils.isEmpty(data.getPort()))return true;
		if(TextUtils.isEmpty(data.getIp()) )return true;

		MyUtils.putSerciceData(data);
		return (TextUtils.isEmpty(MyUtils.getIp()));
//		LogUtil.i("LoginServiceListData.isDataNull()-->"+data.getIp());
//		LogUtil.i("LoginServiceListData.isDataNull()-->"+data.getPort());
//		return false;
	}

	public static LoginServiceListData getFromCache() {
		LoginServiceListData data = (LoginServiceListData) FileUtils.readObject(FILE_CACHE);

		return data;
	}

	public void save() {
		FileUtils.cacheObject(FILE_CACHE, this);
		// FileSaveHandler.saveObject(FILE_CACHE, this);
	}

	private static void delete() {
		FileUtils.cacheObject(FILE_CACHE , null);
		// FileSaveHandler.removeObject(FILE_CACHE);
	}


	private String name;
	private String ip;
	private String port;
	private String imei;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getIp() {
		return ip;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}

	public String getPort() {
		return port;
	}

	public void setPort(String port) {
		this.port = port;
	}

	public String getImei() {
		return imei;
	}

	public void setImei(String imei) {
		this.imei = imei;
	}
}
